var app = getApp();
var util = require("../../utils/libs.js")
var api = require("../../utils/api.js")
var data = require("../../utils/date.js")
Page({
  data: {
     skillList:[
       {imgUrl:'../../imgs/dragonstory_03.png',
       title:'小王和爷爷下雨天出不去',
       number:0,
       type:'修改意见',
      content:'写一篇关于历史流年岁月穿梭的美好爱情故事写一篇关于历史流年岁月穿梭的美好爱....'},
      {imgUrl:'../../imgs/dragonstory_03.png',title:'小王和爷爷下雨天出不去',
      content:'写一篇关于历史流年岁月穿梭的美好爱情故事写一篇关于历史流年岁月穿梭的美好爱....'},
      {imgUrl:'../../imgs/dragonstory_03.png',title:'小王和爷爷下雨天出不去',
      content:'写一篇关于历史流年岁月穿梭的美好爱情故事写一篇关于历史流年岁月穿梭的美好爱....'}  
     ],
     page:0,
     limit:10
  },
  onLoad (options) {
    let that = this
    // 页面初始化 options为页面跳转所带来的参数
    that.getList()
  },
  getList(){
    let that = this
    util.request(api.articleLists,
      {page:that.data.page,
      limit:that.data.limit
      },"GET")
    .then(function (res) {
      if(res.error_code === 0){
        console.log(res)
        var arr = res.data.list
        arr.forEach(val => {
          val.create_time = data.data(val.create_time)
        });
         that.setData({
          skillList:arr
         })
      }
    })
  },
  goDetail(e){
    let id = e.currentTarget.dataset.id
    wx.navigateTo({
      url:"/pages/assist/assist?id="+id
    })
  },
  onReady () {
    // 页面渲染完成
  },
  onShow () {
    // 页面显示
  },
  onHide () {
    // 页面隐藏

  },
  onUnload () {
    // 页面关闭

  }
})
